import Vue from "vue";
import Vuex from "vuex";

Vue.use(Vuex);

const state = {
    count : 0,
};
const mutations = {
    add(state,num){
        state.count += num;
    },
    addObj(state,{num}){
        state.count += num;
    },

    decrement(state,num){
        state.count -= num;
    },
    decrementObj(state,num){
        state.count -= num;
    }
};
const actions = {
    decrementAct({commit},num){
        commit('decrement',num);
    },
    decrementObjAct({commit},{num}){
        commit("decrementObj",num);
    }
};
const getters = {};

export default new Vuex.Store({
    actions,
    mutations,
    state,
    getters
})